<template>
  <div class="tool-bar-ri">
    <div class="header-icon">
      <ProjectSelect/>
      <AssemblySize id="assemblySize"/>
      <Language id="language"/>
      <!--      <SearchMenu id="searchMenu" />-->
      <ThemeSetting id="themeSetting"/>
      <Message id="message"/>
      <Fullscreen id="fullscreen"/>
    </div>
    <span class="username">{{ username }}</span>
    <el-badge is-dot :type="wsStatus === 'OPEN'?'success':'danger'">
      <Avatar/>
    </el-badge>
  </div>
</template>

<script setup>
import {computed, onMounted} from "vue";
import {useUserStore} from "@/stores/modules/user";
import AssemblySize from "./components/AssemblySize.vue";
import Language from "./components/Language.vue";
import ProjectSelect from "./components/ProjectSelect.vue";
import ThemeSetting from "./components/ThemeSetting.vue";
import Message from "./components/Message.vue";
import Fullscreen from "./components/Fullscreen.vue";
import Avatar from "./components/Avatar.vue";
import {wsStatus} from '@/utils/wsMessage.js'
import {getCheckUser} from "@/api/modules/user.js";
const userStore = useUserStore();
const username = computed(() => userStore.userInfo.nickname);

onMounted(()=>{
  getCheckUser()
})


// WebSocket #########################
// import {useWebSocket} from '@vueuse/core'
//
// const userid = computed(() => userStore.userInfo.userid);
//
// const skUrl = import.meta.env.VITE_WS_API_URL + '/api/skTest1/' + userid.value
//
// const wsConnect = useWebSocket(skUrl, {
//   heartbeat: true,
//   autoReconnect: true,
//   immediate: true
// })
// wsConnect.send("121221")


</script>

<style scoped lang="scss">
.tool-bar-ri {
  display: flex;
  align-items: center;
  justify-content: center;
  //padding-right: 25px;
  .header-icon {
    display: flex;
    align-items: center;

    & > * {
      margin-left: 21px;
      color: var(--el-header-text-color);
    }
  }

  .username {
    margin: 0 20px;
    font-size: 15px;
    color: var(--el-header-text-color);
  }

}
</style>
